/**
 * 兽药经营企业监督检查记录表
 * @constructor
 */
function VeterinaryDrug() {
}

VeterinaryDrug.init = function () {
    getName1();
    $('#tableList').bootstrapTable({
        url: '/veterinaryDrug/tableSearch',
        method: 'post',
        striped: true, //是否显示行间隔色
        toolbar: "#toolbar",
        sidePagination: "true",
        dataField: "data",//这是返回的json数组的key.默认是"rows".这里只有前后端约定好就行
        showToggle: true, //是否显示详细视图和列表视图的切换按钮
        striped: true, // 是否显示行间隔色
//search : "true",
        uniqueId: "id",
        pageList: [5, 10, 20, 50, 100],//可选择单页记录数
        pageSize: "10",
        pagination: true, // 是否分页
        sortable: true, // 是否启用排序
        sidePagination: 'server', // 设置为服务器端分页     客户端：client
        search: false,
        showColumns: true,
        showRefresh: true,
        showExport: true,
//得到查询的参数
        queryParams: function (params) {
//这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
            var query_params = {
//********table的参数 不变
                pageSize: params.limit,                         //页面大小
                pageIndex: (params.offset / params.limit) + 1,   //页码
                sort: params.sort,      //排序列名
                sortOrder: params.order, //排位命令（desc，asc）
//********
//获取查询的对象，往下加入
                timeInterval: $('#search_InspectionDate').val(), // 请求时向服务端传递的参数
            };
            return query_params;
        },
        columns: [
            {
//field: 'Number',//可不加
                title: '序号',//标题  可不加
                align: "center",
                width: 40,
                formatter: function (value, row, index) {
                    var pageSize = $('#tableList').bootstrapTable('getOptions').pageSize;//通过表的#id 可以得到每页多少条
                    var pageNumber = $('#tableList').bootstrapTable('getOptions').pageNumber;//通过表的#id 可以得到当前第几页
                    return pageSize * (pageNumber - 1) + index + 1;//返回每条的序号： 每页条数 * （当前页 - 1 ）+ 序号
                }
            },
            {field: 'inspectionDate', title: '检查日期', align: 'center'},
            {field: 'ename', title: '企业名称', align: 'center'},
            {field: 'withoutLicense', title: '是否无许可证经营', align: 'center'},
            {field: 'licenseNo', title: '经营许可证号', align: 'center'},
            {field: 'withoutGSP', title: '是否无GSP证经营', align: 'center'},
            {field: 'gspno', title: '兽药GSP证号', align: 'center'},
            {field: 'businessScope', title: '经营范围', align: 'center'},
            {field: 'rangeBusiness', title: '是否超范围经营', align: 'center'},
            {field: 'changeManagementAddress', title: '经营地址是否变更', align: 'center'},
            {field: 'managementAddress', title: '经营地址', align: 'center'},
            {field: 'changeStorageAddress', title: '仓储地址是否变更', align: 'center'},
            {field: 'storageAddress', title: '仓储地址', align: 'center'},
            {field: 'businessArea', title: '经营面积≥20m²', align: 'center'},
            {field: 'warehouseArea', title: '仓库面积≥40m²', align: 'center'},
            {field: 'biobank', title: '生物制品库≥30m²', align: 'center'},
            {field: 'standardArea', title: '面积是否达标', align: 'center'},
            {field: 'actualArea', title: '实际面积', align: 'center'},
            {field: 'counter', title: '陈列货架、柜台', align: 'center'},
            {field: 'ventilate', title: '通风、防火和照明设施、设备', align: 'center'},
            {field: 'temperature', title: '温度、湿度、光照等控制设施、设备和监控仪表', align: 'center'},
            {field: 'dustproof', title: '防尘、防潮、防污染和防虫、防鼠、防鸟的设施、设备', align: 'center'},
            {field: 'environmental', title: '环境和人员卫生、清洁的设施、设备等', align: 'center'},
            {
                field: 'bulletinBoard',
                title: '在营业场所显著位置设置兽药质量信息公示板，张贴兽药管理法规、人员职责和分工，明示服务公约、质量承诺和服务监督电话，设置意见簿',
                align: 'center'
            },
            {field: 'legalName', title: '法人姓名', align: 'center'},
            {field: 'legalPhone', title: '法人联系方式', align: 'center'},
            {field: 'legalWhether', title: '法人是否符合规定', align: 'center'},
            {field: 'directorName', title: '质量负责人', align: 'center'},
            {field: 'directorPhone', title: '质量负责人联系方式', align: 'center'},
            {field: 'directorWhether', title: '质量联系人是否符合规定', align: 'center'},
            {field: 'staffName', title: '从业人员数量', align: 'center'},
            // {field: 'staffPhone', title: '员工人数联系方式', align: 'center'},
            {field: 'staffWhether', title: '员工人数是否符合规定', align: 'center'},
            {field: 'prohibitedDrug', title: '是否有违禁药物', align: 'center'},
            {field: 'fakeMedicine', title: '是否有假兽药', align: 'center'},
            {field: 'badMedicine', title: '是否有劣兽药', align: 'center'},
            {field: 'nonproductive', title: '是否有人用药、无证经营生物制品、原料要拆零销售或销售到非生产企业', align: 'center'},
            {field: 'ruleIncomplete', title: '规章制度不齐全、不执行', align: 'center'},
            {field: 'purchaseIncomplete', title: '采购记录不齐全', align: 'center'},
            {field: 'shopIncomplete', title: '销售记录不齐全', align: 'center'},
            {field: 'refuse', title: '是否拒绝或不配合检查', align: 'center'},
            {field: 'rectification', title: '整改跟踪检查情况', align: 'center'},
            {field: 'examination', title: '检查结论及处理意见', align: 'center'},
            {field: 'enterpriseOpinion', title: '企业意见', align: 'center'},
            {field: 'inspectorSignature', title: '检查员签名', align: 'center'},
            {field: 'legalPersonSignature', title: '法人或质量负责人签名', align: 'center'},
            {
                title: '操作',
                align: 'center',
                formatter: function (value, row, index) {
                    var optionHtml = "";
                    optionHtml = optionHtml + "<a class=\"btn btn-success btn-xs\"  href=\"javascript:void(0)\"  onclick='actionRecord(" + JSON.stringify(row) + ",\"edit\")' title=\"修改\" ><i class=\"fa fa-edit\"></i>修改</a>";
                    optionHtml = optionHtml + " <a class=\"btn btn-danger btn-xs\" href=\"javascript:void(0)\"  onclick='actionRecord(" + JSON.stringify(row) + ",\"delete\")'  title=\"删除\"><i class=\"fa fa-remove\"></i>删除</a>"
                    return optionHtml;
                }
            }
        ]
    });
}

//时间选择器
laydate.render({
    elem: '#text_inspectionDate',
    theme: 'molv',
    type:"date",
});
laydate.render({
    elem: '#search_InspectionDate',
    range: true,
});
//查询方法****************************
function doSearch() {
// $('#tableList').bootstrapTable(('refresh')); // 很重要的一步，刷新url！
    $("#tableList").bootstrapTable("refreshOptions", {pageNumber: 1});
}

//重置****************************
function doRest() {
    $("#search_InspectionDate").val("");
// $('#tableList').bootstrapTable(('refresh')); // 很重要的一步，刷新url！
    $("#tableList").bootstrapTable("refreshOptions", {pageNumber: 1});
}

//增加方法****************************
var Action = "";
var id = 0;
var pxt = "/veterinaryDrug"; //控制器名称
function addRecord() {
    id = 0;
    Action = "add";
    $("#myform")[0].reset();

}

//增加/修改数据保存****************************
function saveRecord() {
    if (!validateForm()) return false;
//创建传递的参数
    var postdata = {
        id: id,
        action: Action,

        inspectionDate: $("#text_inspectionDate").val(),
        ename:$("#text_ename").find("option:selected").text(),
        eid:$("#text_ename").val(),
        licenseNo: $("#text_licenseNo").val(),
        gspno: $("#text_gSPNo").val(),
        businessScope: $("#text_businessScope").val(),
        rangeBusiness: $("#text_range").val(),
        changeManagementAddress: $("#text_changeManagementAddress").val(),
        managementAddress: $("#text_managementAddress").val(),
        changeStorageAddress: $("#text_changeStorageAddress").val(),
        storageAddress: $("#text_storageAddress").val(),
        businessArea: $("#text_businessArea").val(),
        warehouseArea: $("#text_warehouseArea").val(),
        biobank: $("#text_biobank").val(),
        standardArea: $("#text_standardArea").val(),
        actualArea: $("#text_actualArea").val(),
        counter: $("#text_counter").val(),
        ventilate: $("#text_ventilate").val(),
        temperature: $("#text_temperature").val(),
        dustproof: $("#text_dustproof").val(),
        environmental: $("#text_environmental").val(),
        bulletinBoard: $("#text_bulletinBoard").val(),
        legalName: $("#text_legalName").val(),
        legalPhone: $("#text_legalPhone").val(),
        legalWhether: $("#text_legalWhether").val(),
        directorName: $("#text_directorName").val(),
        directorPhone: $("#text_directorPhone").val(),
        directorWhether: $("#text_directorWhether").val(),
        staffName: $("#text_staffName").val(),
        // staffPhone: $("#text_staffPhone").val(),
        staffWhether: $("#text_staffWhether").val(),
        prohibitedDrug: $("#text_prohibitedDrug").val(),
        fakeMedicine: $("#text_fakeMedicine").val(),
        badMedicine: $("#text_badMedicine").val(),
        nonproductive: $("#text_nonproductive").val(),
        ruleIncomplete: $("#text_ruleIncomplete").val(),
        purchaseIncomplete: $("#text_purchaseIncomplete").val(),
        shopIncomplete: $("#text_shopIncomplete").val(),
        refuse: $("#text_refuse").val(),
        rectification: $("#text_rectification").val(),
        examination: $("#text_examination").val(),
        enterpriseOpinion: $("#text_enterpriseOpinion").val(),
        inspectorSignature: $("#text_inspectorSignature").val(),
        legalPersonSignature: $("#text_legalPersonSignature").val(),
    };
console.log("兽药经营",JSON.stringify(postdata));
//发送异步请求到后台保存用户数据
    $.ajax({
        url: pxt + (Action == "add" ? "/save" : "/update"),
        type: "post",
        data: JSON.stringify(postdata),
        contentType: "application/json",
        dataType: "json",
        success: function (data) {
            if (data.code === "200") {
                $('#myModalAdd').modal('hide')
                doSearch();
                swal("操作成功!", "请继续操作", "success");
            } else {
                swal("操作失败!", "请重试", "error");
            }
        }
    });
}

//操作相关方法****************************
function actionRecord(data, type) {
    if (type == "edit") {
//修改
        id = data.id;
        Action = "edit";
        $("#myform")[0].reset();
        $("#save").removeAttr("disabled");
        WriteData(data)
        $('#myModalAdd').modal('show')
    } else {
//删除
        swal({
            title: "确认是否删除",
            text: "是否确认要删除该条记录？",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "删除",
            cancelButtonText: "取消",
            closeOnConfirm: false
        }, function () {
//点击删除之后此处进行传递后台
            $.ajax({
                type: "delete",
                url: pxt + "/deleteById/" + data.id,
                dataType: "json",
                contentType: "application/json",
                success: function (data, status) {
                    if (data.code == "200") {
                        doSearch();
                        swal("删除成功!", "请继续操作", "success");
                    } else {
                        swal("删除失败!", "请重试", "error");
                    }
                }
            });

        });
    }
}

//给控件赋值****************************
function WriteData(data) {
    $("#text_inspectionDate").val(data.inspectionDate);
    $("#text_licenseNo").val(data.licenseNo);
    $("#text_ename").val(data.eid);
    $("#text_gSPNo").val(data.gspno);
    $("#text_businessScope").val(data.businessScope);
    $("#text_range").val(data.rangeBusiness);
    $("#text_changeManagementAddress").val(data.changeManagementAddress);
    $("#text_managementAddress").val(data.managementAddress);
    $("#text_changeStorageAddress").val(data.changeStorageAddress);
    $("#text_storageAddress").val(data.storageAddress);
    $("#text_businessArea").val(data.businessArea);
    $("#text_warehouseArea").val(data.warehouseArea);
    $("#text_biobank").val(data.biobank);
    $("#text_standardArea").val(data.standardArea);
    $("#text_actualArea").val(data.actualArea);
    $("#text_counter").val(data.counter);
    $("#text_ventilate").val(data.ventilate);
    $("#text_temperature").val(data.temperature);
    $("#text_dustproof").val(data.dustproof);
    $("#text_environmental").val(data.environmental);
    $("#text_bulletinBoard").val(data.bulletinBoard);
    $("#text_legalName").val(data.legalName);
    $("#text_legalPhone").val(data.legalPhone);
    $("#text_legalWhether").val(data.legalWhether);
    $("#text_directorName").val(data.directorName);
    $("#text_directorPhone").val(data.directorPhone);
    $("#text_directorWhether").val(data.directorWhether);
    $("#text_staffName").val(data.staffName);
    // $("#text_staffPhone").val(data.staffPhone);
    $("#text_staffWhether").val(data.staffWhether);
    $("#text_prohibitedDrug").val(data.prohibitedDrug);
    $("#text_fakeMedicine").val(data.fakeMedicine);
    $("#text_badMedicine").val(data.badMedicine);
    $("#text_nonproductive").val(data.nonproductive);
    $("#text_ruleIncomplete").val(data.ruleIncomplete);
    $("#text_purchaseIncomplete").val(data.purchaseIncomplete);
    $("#text_shopIncomplete").val(data.shopIncomplete);
    $("#text_refuse").val(data.refuse);
    $("#text_rectification").val(data.rectification);
    $("#text_examination").val(data.examination);
    $("#text_enterpriseOpinion").val(data.enterpriseOpinion);
    $("#text_inspectorSignature").val(data.inspectorSignature);
    $("#text_legalPersonSignature").val(data.legalPersonSignature);
}

//表单验证*****************************
function validateForm() {
//validate方法参数可选
    return $("#myform").validate({
        rules: {

            text_inspectionDate: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_ename: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_businessScope: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_range: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_changeManagementAddress: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_changeStorageAddress: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_businessArea: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_warehouseArea: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_biobank: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_standardArea: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_actualArea: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_counter: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_ventilate: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_temperature: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_dustproof: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_environmental: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_bulletinBoard: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_legalName: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_legalPhone: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_legalWhether: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_directorName: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_directorPhone: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_directorWhether: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_staffName: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            // text_staffPhone: {
            //     required: true,//必填
            //     minlength: 1, //最少1个字符
            //     maxlength: 50,//最多50个字符
            //     // number: true, //必须是数字
            // },
            text_staffWhether: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_prohibitedDrug: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_fakeMedicine: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_badMedicine: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_nonproductive: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_ruleIncomplete: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_purchaseIncomplete: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_shopIncomplete: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_refuse: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_rectification: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_examination: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_enterpriseOpinion: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_inspectorSignature: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_legalPersonSignature: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
        },
//错误信息提示
        messages: {
            text_inspectionDate: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_ename: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_businessScope: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_range: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_changeManagementAddress: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_changeStorageAddress: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_businessArea: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_warehouseArea: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_biobank: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_standardArea: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_actualArea: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_counter: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_ventilate: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_temperature: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_dustproof: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_environmental: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_bulletinBoard: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_legalName: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_legalPhone: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_legalWhether: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_directorName: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_directorPhone: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_directorWhether: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_staffName: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            // text_staffPhone: {
            //     required: "(必填)",
            //     minlength: 1, //最少1个字符
            //     maxlength: 50,//最多50个字符
            //     // number: true, //必须是数字
            // },
            text_staffWhether: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_prohibitedDrug: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_fakeMedicine: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_badMedicine: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_nonproductive: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_ruleIncomplete: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_purchaseIncomplete: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_shopIncomplete: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_refuse: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_rectification: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_examination: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_enterpriseOpinion: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_inspectorSignature: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
            text_legalPersonSignature: {
                required: "(必填)",
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                // number: true, //必须是数字
            },
        },
    }).form();

}
//给下拉选赋值
function getName1() {
    var postdata={
        types:4,
    };
    $.ajax({
        url: "/mechanism/getName",
        type:"post",
        data: JSON.stringify(postdata),
        contentType:"application/json",
        dataType:"json",
        success:function(data){
            $('#text_ename').empty();
            $('#text_ename').append("<option value='-1'>请选择企业名称</option>");
            $.each(data.data,function (index,item) {
                $('#text_ename').append("<option value='"+item.id+"'>"+item.name+"</option>");
            })
        }
    });
}
//根据下拉选自动生成表格内容
function getName2(a) {
    var postdata={
        types:4,
        id:a,
    };
    $.ajax({
        url: "/mechanism/getName",
        type:"post",
        data: JSON.stringify(postdata),
        contentType:"application/json",
        dataType:"json",
        success:function(data){
            if (data.data.length <= 0){
                $('#text_licenseNo').val("");
                $('#text_legalName').val("");
                $('#text_managementAddress').val("");
                $('#text_legalPhone').val("");
                return false;
            }
            $.each(data.data,function (index,item) {
                $('#text_licenseNo').val(item.idCard);
                $('#text_legalName').val(item.userName);
                $('#text_managementAddress').val(item.fullAddress);
                $('#text_legalPhone').val(item.phone);
            })
        }
    });
}
